<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="{{ asset('home/login.css') }}">
    <link rel="stylesheet" href="{{ asset('tool/layui/css/layui.css') }}">
    <script src="{{ asset('tool/js/jquery.min.js') }}"></script>
    <script src="{{ asset('tool/layui/layui.js') }}"></script>
    <title>登录</title>
</head>

<body>
<section>
    <!-- 背景颜色 -->
    <div class="color"></div>
    <div class="color"></div>
    <div class="color"></div>
    <div class="box">
        <!-- 背景圆 -->
        <div class="circle" style="--x:0"></div>
        <div class="circle" style="--x:1"></div>
        <div class="circle" style="--x:2"></div>
        <div class="circle" style="--x:3"></div>
        <div class="circle" style="--x:4"></div>
        <!-- 登录框 -->
        <div class="container">
            <div class="form">
                <h2>登录</h2>
                <form class="layui-form" id="loginForm">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <div class="inputBox">
                        <input type="text" id="username" name="username" lay-verify="required" placeholder="姓名">
                    </div>
                    <div class="inputBox">
                        <input type="password" id="password" name="password" lay-verify="required" placeholder="密码">
                    </div>
                    <div class="inputBox">
                        <input type="submit" id="submitAdd" value="登录" lay-filter="submitAdd">
                    </div>
                    {{--<p class="forget">忘记密码?<a href="#">
                            点击这里
                        </a></p>
                    <p class="forget">没有账户?<a href="#">
                            注册
                        </a></p>--}}
                </form>
            </div>
        </div>
    </div>
</section>

<script>


    layui.use(['form', 'layer'], function() {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        $('#submitAdd').on('click', function(){
            $.post("login",$('#loginForm').serialize(),function (res) {
                if(res.code == 0){
                    layer.msg(res.msg, {icon: 6,time: 1500}, function() {
                        window.location.href = "/maintain-order";
                    });
                }else{
                    layer.msg(res.msg);
                }
            });
            return false;
        });

    });
</script>
</body>

</html>
